{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "7020888c-bdf7-44d3-ade8-ef8d180aa65c",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "import sys\n",
    "import os\n",
    "if not any(path.endswith('textbook') for path in sys.path):\n",
    "    sys.path.append(os.path.abspath('../../..'))\n",
    "from textbook_utils import *"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "851224ed-7c31-480a-8356-431197667297",
   "metadata": {},
   "source": [
    "# NetCDF Data"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b728d01d-e1f8-4ebb-97d3-ff43b6d892bb",
   "metadata": {},
   "source": [
    "The [Network Common Data Form (NetCDF)](https://www.unidata.ucar.edu/software/netcdf/) is a convenient and efficient format for storing array-oriented scientific data. A mental model for this format represents a variable by a multidimensional grid of values. The diagram in {numref}`Figure %s <netCDF-diagram>` shows the concept. A variable such as rainfall is recorded daily at places around the globe. We can imagine these rainfall values arranged in a cube with longitude running along one side of the cube, latitude along another, and date in the third dimension. Each cell in the cube holds the rainfall recorded for one day at a particular location. A NetCDF file also contains information, which we call _metadata_, about the dimensions of the cube. The same information would be organized quite differently in a data frame, where we would need three features for latitude, longitude, and date for each rainfall measurement. This would mean repeating lots of data. With a NetCDF file, we don't need to repeat the latitude and longitude values for each day, nor the dates for each location."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bb017ee3-b23e-432c-ad7a-5f662d3514c4",
   "metadata": {},
   "source": [
    "```{figure} figures/netCDF-diagram.png\n",
    "---\n",
    "name: netCDF-diagram\n",
    "---\n",
    "\n",
    "This diagram represents a model for NetCDF data. The data are organized into a three-dimensional array that contains recordings of rainfall at locations in time (latitude, longitude, and time). The \"X\" marks one rainfall measurement for a specific location on a particular date.\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dcc2ba81-9876-4061-801c-8d6dd97c8d40",
   "metadata": {},
   "source": [
    "NetCDF has several other advantages, in addition to being more compact:\n",
    "\n",
    "Scalable\n",
    ": It provides efficient access to subsets of the data.\n",
    "\n",
    "Appendable\n",
    ": You can easily add new data without redefining the structure.\n",
    "\n",
    "Sharable\n",
    ": It's a common format that's independent of the coding language and operating system.\n",
    "\n",
    "Self-describing\n",
    ": The source file contains both a description of the data's organization and the data itself.\n",
    "\n",
    "Community\n",
    ": The tools are made available by a community of users."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "00f9914b",
   "metadata": {},
   "source": [
    ":::{note}\n",
    "\n",
    "The NetCDF format is an example of *binary* data---data that can't directly be\n",
    "read into a text editor like `vim` or Visual Studio Code, unlike text formats\n",
    "like CSV. There are a multitude of other binary data formats, including SQLite\n",
    "databases (from {numref}`Chapter %s <ch:sql>`), Feather, and Apache Arrow.\n",
    "Binary data formats provide flexibility in how datasets are stored, but they also\n",
    "typically need special tools to open and read them in.\n",
    "\n",
    ":::"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b0f7641a-1006-4c7b-8560-9d1dcbb8c554",
   "metadata": {},
   "source": [
    "NetCDF variables are not limited to three dimensions. For example, elevation could be added to our earth science application so that we have recordings of, say, temperature,  in time, latitude, longitude, and elevation. And dimensions need not correspond to physical dimensions. Climate scientists often run several models and store the model number in a dimension along with the model output. While NetCDF was originally developed for atmospheric scientists at the University Corporation for Atmospheric Research (UCAR), the format has gained popularity and is now used at thousands of educational, research, and government sites around the world. And the applications have expanded to other areas, such as astronomy and physics with the [Smithsonian/NASA Astrophysics Data System (ADS)](https://science.nasa.gov/astrophysics/astrophysics-data-centers/smithsonian-nasa-astrophysics-data-system-ads) and medical imaging with [Medical Image NetCDF (MINC)](http://www.bic.mni.mcgill.ca/software/minc/minc.html). "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c9935cf3-62f5-4a7b-9d31-da4c136c4e3d",
   "metadata": {},
   "source": [
    "NetCDF files have three basic components: dimensions, variables, and various sorts of metadata. The *variable* contains what we think of as the data, such as the rainfall recordings. Each variable has a name, storage type, and shape, meaning the number of dimensions. The *dimensions* component gives each dimension's name and number of grid points. Additional information is provided by the *coordinates*—in particular, the points at which the measurements are made, such as for longitude, where these might be $0.0, 0.25, 0.50, \\ldots, 359.75$.  Other metadata include *attributes*. Attributes for a variable can hold ancillary information about the variables, and other attributes contain global information about the file, such as who published the dataset, their contact information, and permissions for using the data. This global information is critical to ensure reproducible results.  \n",
    "\n",
    "The following example examines the components of a particular NetCDF file and demonstrates how to extract portions of data from variables. "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0d005c55-8f07-424b-9670-62d3bcca773c",
   "metadata": {},
   "source": [
    "The [Climate Data Store](https://cds.climate.copernicus.eu/) provides a collection of datasets from various climate sectors and services. We visited their site and requested measurements of temperature and total precipitation for a two-week period in December 2022. Let's walk through a brief examination of these data to get a sense of the organization of the components in the file, how to extract subsets, and how to make visualizations.\n",
    "\n",
    "The data are in the NetCDF file _CDS_ERA5_22-12.nc_. Let's first figure out how large the file is: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d6439658-27f9-4d23-bf25-48b99fe58f69",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.0"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pathlib import Path\n",
    "import os\n",
    "\n",
    "file_path = Path() / 'data' / 'CDS_ERA5_22-12.nc'\n",
    "\n",
    "kib = 1024\n",
    "size = os.path.getsize(file_path)\n",
    "np.round(size / kib**3)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e7dd1444-08fe-4935-b861-c857bcf6515b",
   "metadata": {},
   "source": [
    "Despite having only three variables (total precipitation, rain rate, temperature) for two weeks, the file is two GiB in size! These climate sources often tend to be quite large.\n",
    "\n",
    "The `xarray` package is useful for working with array-like data and, in particular, NetCDF. We use its functionality to explore the components of our climate file.  First we open the file:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0fd4b2d0-3f7b-465a-89d4-ca8f53d95200",
   "metadata": {},
   "outputs": [],
   "source": [
    "import xarray as xr\n",
    "\n",
    "ds = xr.open_dataset(file_path)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ea543926-c109-4f54-a4e4-c3ed7b8e1034",
   "metadata": {},
   "source": [
    "Now let's check the dimensions component of the file:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e6658ccf-5719-42f0-87ab-c789af7d478a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Frozen(SortedKeysDict({'longitude': 1440, 'latitude': 721, 'time': 408}))"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds.dims"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0e2562f6-2417-4527-9877-e290150439ce",
   "metadata": {},
   "source": [
    "As in {numref}`Figure %s <netCDF-diagram>`, our file has three dimensions: longitude, latitude, and time. The size of each dimension tells us that there are over 400,000 cells of data values ($1440 * 721 * 408$). If these data were in a data frame, then it would have 400,000 rows with latitude, longitude, and time columns in great repetition! Instead, we only need their values once, and the coordinates component gives them to us:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "48536b19-78ae-45b2-9330-bbf864cb5131",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Coordinates:\n",
       "  * longitude  (longitude) float32 0.0 0.25 0.5 0.75 ... 359.0 359.2 359.5 359.8\n",
       "  * latitude   (latitude) float32 90.0 89.75 89.5 89.25 ... -89.5 -89.75 -90.0\n",
       "  * time       (time) datetime64[ns] 2022-12-15 ... 2022-12-31T23:00:00"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds.coords"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "de22884b-7c44-4108-88fa-c7b98beb1fe4",
   "metadata": {},
   "source": [
    "Each variable in our file is three-dimensional. Actually, a variable doesn't have to have all three dimensions, but in our example they do:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "d7acf691-0fa0-4078-a073-ece9159d0c8a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Data variables:\n",
       "    t2m      (time, latitude, longitude) float32 ...\n",
       "    lsrr     (time, latitude, longitude) float32 ...\n",
       "    tp       (time, latitude, longitude) float32 ..."
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds.data_vars"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "99de1064-2a8e-4a97-97ff-1e8a176ab869",
   "metadata": {},
   "source": [
    "Metadata for a variable provides the units and a longer description, while metadata for the source gives us information such as when we retrieved the data:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "3326a3e2-c13a-4f6f-a185-ff31cd1c2202",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'units': 'm', 'long_name': 'Total precipitation'}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds.tp.attrs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "881aed7c-fb35-4179-a184-e601bd3160e4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Conventions': 'CF-1.6',\n",
       " 'history': '2023-01-19 19:54:37 GMT by grib_to_netcdf-2.25.1: /opt/ecmwf/mars-client/bin/grib_to_netcdf.bin -S param -o /cache/data6/adaptor.mars.internal-1674158060.3800251-17201-13-c46a8ac2-f1b6-4b57-a14e-801c001f7b2b.nc /cache/tmp/c46a8ac2-f1b6-4b57-a14e-801c001f7b2b-adaptor.mars.internal-1674158033.856014-17201-20-tmp.grib'}"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds.attrs"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d6c53420-71c0-49d6-9d3d-c7093034c162",
   "metadata": {},
   "source": [
    "By keeping all of these pieces of information in the source file itself, we don't risk losing it or having the description get out of sync with the data."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cfa6765a-1c13-442d-9c70-bd49f0805dce",
   "metadata": {},
   "source": [
    "Like with `pandas`, `xarray` provides many different ways to select portions of the data to work with. We show two examples. First we focus on one specific location and examine the total precipitation in time with a line plot:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5cfc33aa-3548-4fc8-a956-a48fdf34d752",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 288x216 with 0 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Created with matplotlib (https://matplotlib.org/) -->\n",
       "<svg height=\"232.59851pt\" version=\"1.1\" viewBox=\"0 0 495.084375 232.59851\" width=\"495.084375pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-07-19T11:25:44.659676</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.3.4, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linecap:butt;stroke-linejoin:round;}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 232.59851 \n",
       "L 495.084375 232.59851 \n",
       "L 495.084375 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill:#ffffff;\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 41.484375 184.905 \n",
       "L 487.884375 184.905 \n",
       "L 487.884375 21.825 \n",
       "L 41.484375 21.825 \n",
       "z\n",
       "\" style=\"fill:#ffffff;\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 61.775284 184.905 \n",
       "L 61.775284 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- 2022-12-15 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(16.487041 223.677285)rotate(-30)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path d=\"M 50.34375 8.453125 \n",
       "L 50.34375 0 \n",
       "L 3.03125 0 \n",
       "Q 2.9375 3.171875 4.046875 6.109375 \n",
       "Q 5.859375 10.9375 9.828125 15.625 \n",
       "Q 13.8125 20.3125 21.34375 26.46875 \n",
       "Q 33.015625 36.03125 37.109375 41.625 \n",
       "Q 41.21875 47.21875 41.21875 52.203125 \n",
       "Q 41.21875 57.421875 37.46875 61 \n",
       "Q 33.734375 64.59375 27.734375 64.59375 \n",
       "Q 21.390625 64.59375 17.578125 60.78125 \n",
       "Q 13.765625 56.984375 13.71875 50.25 \n",
       "L 4.6875 51.171875 \n",
       "Q 5.609375 61.28125 11.65625 66.578125 \n",
       "Q 17.71875 71.875 27.9375 71.875 \n",
       "Q 38.234375 71.875 44.234375 66.15625 \n",
       "Q 50.25 60.453125 50.25 52 \n",
       "Q 50.25 47.703125 48.484375 43.546875 \n",
       "Q 46.734375 39.40625 42.65625 34.8125 \n",
       "Q 38.578125 30.21875 29.109375 22.21875 \n",
       "Q 21.1875 15.578125 18.9375 13.203125 \n",
       "Q 16.703125 10.84375 15.234375 8.453125 \n",
       "z\n",
       "\" id=\"ArialMT-50\"/>\n",
       "        <path d=\"M 4.15625 35.296875 \n",
       "Q 4.15625 48 6.765625 55.734375 \n",
       "Q 9.375 63.484375 14.515625 67.671875 \n",
       "Q 19.671875 71.875 27.484375 71.875 \n",
       "Q 33.25 71.875 37.59375 69.546875 \n",
       "Q 41.9375 67.234375 44.765625 62.859375 \n",
       "Q 47.609375 58.5 49.21875 52.21875 \n",
       "Q 50.828125 45.953125 50.828125 35.296875 \n",
       "Q 50.828125 22.703125 48.234375 14.96875 \n",
       "Q 45.65625 7.234375 40.5 3 \n",
       "Q 35.359375 -1.21875 27.484375 -1.21875 \n",
       "Q 17.140625 -1.21875 11.234375 6.203125 \n",
       "Q 4.15625 15.140625 4.15625 35.296875 \n",
       "z\n",
       "M 13.1875 35.296875 \n",
       "Q 13.1875 17.671875 17.3125 11.828125 \n",
       "Q 21.4375 6 27.484375 6 \n",
       "Q 33.546875 6 37.671875 11.859375 \n",
       "Q 41.796875 17.71875 41.796875 35.296875 \n",
       "Q 41.796875 52.984375 37.671875 58.78125 \n",
       "Q 33.546875 64.59375 27.390625 64.59375 \n",
       "Q 21.34375 64.59375 17.71875 59.46875 \n",
       "Q 13.1875 52.9375 13.1875 35.296875 \n",
       "z\n",
       "\" id=\"ArialMT-48\"/>\n",
       "        <path d=\"M 3.171875 21.484375 \n",
       "L 3.171875 30.328125 \n",
       "L 30.171875 30.328125 \n",
       "L 30.171875 21.484375 \n",
       "z\n",
       "\" id=\"ArialMT-45\"/>\n",
       "        <path d=\"M 37.25 0 \n",
       "L 28.46875 0 \n",
       "L 28.46875 56 \n",
       "Q 25.296875 52.984375 20.140625 49.953125 \n",
       "Q 14.984375 46.921875 10.890625 45.40625 \n",
       "L 10.890625 53.90625 \n",
       "Q 18.265625 57.375 23.78125 62.296875 \n",
       "Q 29.296875 67.234375 31.59375 71.875 \n",
       "L 37.25 71.875 \n",
       "z\n",
       "\" id=\"ArialMT-49\"/>\n",
       "        <path d=\"M 4.15625 18.75 \n",
       "L 13.375 19.53125 \n",
       "Q 14.40625 12.796875 18.140625 9.390625 \n",
       "Q 21.875 6 27.15625 6 \n",
       "Q 33.5 6 37.890625 10.78125 \n",
       "Q 42.28125 15.578125 42.28125 23.484375 \n",
       "Q 42.28125 31 38.0625 35.34375 \n",
       "Q 33.84375 39.703125 27 39.703125 \n",
       "Q 22.75 39.703125 19.328125 37.765625 \n",
       "Q 15.921875 35.84375 13.96875 32.765625 \n",
       "L 5.71875 33.84375 \n",
       "L 12.640625 70.609375 \n",
       "L 48.25 70.609375 \n",
       "L 48.25 62.203125 \n",
       "L 19.671875 62.203125 \n",
       "L 15.828125 42.96875 \n",
       "Q 22.265625 47.46875 29.34375 47.46875 \n",
       "Q 38.71875 47.46875 45.15625 40.96875 \n",
       "Q 51.609375 34.46875 51.609375 24.265625 \n",
       "Q 51.609375 14.546875 45.953125 7.46875 \n",
       "Q 39.0625 -1.21875 27.15625 -1.21875 \n",
       "Q 17.390625 -1.21875 11.203125 4.25 \n",
       "Q 5.03125 9.71875 4.15625 18.75 \n",
       "z\n",
       "\" id=\"ArialMT-53\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"111.230469\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"166.845703\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"222.460938\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"255.761719\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"311.376953\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"366.992188\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"400.292969\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"455.908203\" xlink:href=\"#ArialMT-53\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 109.635905 184.905 \n",
       "L 109.635905 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- 2022-12-17 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(64.347662 223.677285)rotate(-30)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path d=\"M 4.734375 62.203125 \n",
       "L 4.734375 70.65625 \n",
       "L 51.078125 70.65625 \n",
       "L 51.078125 63.8125 \n",
       "Q 44.234375 56.546875 37.515625 44.484375 \n",
       "Q 30.8125 32.421875 27.15625 19.671875 \n",
       "Q 24.515625 10.6875 23.78125 0 \n",
       "L 14.75 0 \n",
       "Q 14.890625 8.453125 18.0625 20.40625 \n",
       "Q 21.234375 32.375 27.171875 43.484375 \n",
       "Q 33.109375 54.59375 39.796875 62.203125 \n",
       "z\n",
       "\" id=\"ArialMT-55\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"111.230469\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"166.845703\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"222.460938\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"255.761719\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"311.376953\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"366.992188\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"400.292969\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"455.908203\" xlink:href=\"#ArialMT-55\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 157.496526 184.905 \n",
       "L 157.496526 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- 2022-12-19 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(112.208283 223.677285)rotate(-30)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path d=\"M 5.46875 16.546875 \n",
       "L 13.921875 17.328125 \n",
       "Q 14.984375 11.375 18.015625 8.6875 \n",
       "Q 21.046875 6 25.78125 6 \n",
       "Q 29.828125 6 32.875 7.859375 \n",
       "Q 35.9375 9.71875 37.890625 12.8125 \n",
       "Q 39.84375 15.921875 41.15625 21.1875 \n",
       "Q 42.484375 26.46875 42.484375 31.9375 \n",
       "Q 42.484375 32.515625 42.4375 33.6875 \n",
       "Q 39.796875 29.5 35.234375 26.875 \n",
       "Q 30.671875 24.265625 25.34375 24.265625 \n",
       "Q 16.453125 24.265625 10.296875 30.703125 \n",
       "Q 4.15625 37.15625 4.15625 47.703125 \n",
       "Q 4.15625 58.59375 10.578125 65.234375 \n",
       "Q 17 71.875 26.65625 71.875 \n",
       "Q 33.640625 71.875 39.421875 68.109375 \n",
       "Q 45.21875 64.359375 48.21875 57.390625 \n",
       "Q 51.21875 50.4375 51.21875 37.25 \n",
       "Q 51.21875 23.53125 48.234375 15.40625 \n",
       "Q 45.265625 7.28125 39.375 3.03125 \n",
       "Q 33.5 -1.21875 25.59375 -1.21875 \n",
       "Q 17.1875 -1.21875 11.859375 3.4375 \n",
       "Q 6.546875 8.109375 5.46875 16.546875 \n",
       "z\n",
       "M 41.453125 48.140625 \n",
       "Q 41.453125 55.71875 37.421875 60.15625 \n",
       "Q 33.40625 64.59375 27.734375 64.59375 \n",
       "Q 21.875 64.59375 17.53125 59.8125 \n",
       "Q 13.1875 55.03125 13.1875 47.40625 \n",
       "Q 13.1875 40.578125 17.3125 36.296875 \n",
       "Q 21.4375 32.03125 27.484375 32.03125 \n",
       "Q 33.59375 32.03125 37.515625 36.296875 \n",
       "Q 41.453125 40.578125 41.453125 48.140625 \n",
       "z\n",
       "\" id=\"ArialMT-57\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"111.230469\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"166.845703\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"222.460938\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"255.761719\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"311.376953\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"366.992188\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"400.292969\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"455.908203\" xlink:href=\"#ArialMT-57\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_4\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 205.357147 184.905 \n",
       "L 205.357147 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- 2022-12-21 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(160.068904 223.677285)rotate(-30)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"111.230469\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"166.845703\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"222.460938\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"255.761719\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"311.376953\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"366.992188\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"400.292969\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"455.908203\" xlink:href=\"#ArialMT-49\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 253.217768 184.905 \n",
       "L 253.217768 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- 2022-12-23 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(207.929525 223.677285)rotate(-30)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path d=\"M 4.203125 18.890625 \n",
       "L 12.984375 20.0625 \n",
       "Q 14.5 12.59375 18.140625 9.296875 \n",
       "Q 21.78125 6 27 6 \n",
       "Q 33.203125 6 37.46875 10.296875 \n",
       "Q 41.75 14.59375 41.75 20.953125 \n",
       "Q 41.75 27 37.796875 30.921875 \n",
       "Q 33.84375 34.859375 27.734375 34.859375 \n",
       "Q 25.25 34.859375 21.53125 33.890625 \n",
       "L 22.515625 41.609375 \n",
       "Q 23.390625 41.5 23.921875 41.5 \n",
       "Q 29.546875 41.5 34.03125 44.421875 \n",
       "Q 38.53125 47.359375 38.53125 53.46875 \n",
       "Q 38.53125 58.296875 35.25 61.46875 \n",
       "Q 31.984375 64.65625 26.8125 64.65625 \n",
       "Q 21.6875 64.65625 18.265625 61.421875 \n",
       "Q 14.84375 58.203125 13.875 51.765625 \n",
       "L 5.078125 53.328125 \n",
       "Q 6.6875 62.15625 12.390625 67.015625 \n",
       "Q 18.109375 71.875 26.609375 71.875 \n",
       "Q 32.46875 71.875 37.390625 69.359375 \n",
       "Q 42.328125 66.84375 44.9375 62.5 \n",
       "Q 47.5625 58.15625 47.5625 53.265625 \n",
       "Q 47.5625 48.640625 45.0625 44.828125 \n",
       "Q 42.578125 41.015625 37.703125 38.765625 \n",
       "Q 44.046875 37.3125 47.5625 32.6875 \n",
       "Q 51.078125 28.078125 51.078125 21.140625 \n",
       "Q 51.078125 11.765625 44.234375 5.25 \n",
       "Q 37.40625 -1.265625 26.953125 -1.265625 \n",
       "Q 17.53125 -1.265625 11.296875 4.34375 \n",
       "Q 5.078125 9.96875 4.203125 18.890625 \n",
       "z\n",
       "\" id=\"ArialMT-51\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"111.230469\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"166.845703\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"222.460938\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"255.761719\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"311.376953\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"366.992188\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"400.292969\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"455.908203\" xlink:href=\"#ArialMT-51\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_6\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 301.078389 184.905 \n",
       "L 301.078389 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- 2022-12-25 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(255.790146 223.677285)rotate(-30)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"111.230469\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"166.845703\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"222.460938\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"255.761719\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"311.376953\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"366.992188\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"400.292969\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"455.908203\" xlink:href=\"#ArialMT-53\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 348.93901 184.905 \n",
       "L 348.93901 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- 2022-12-27 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(303.650767 223.677285)rotate(-30)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"111.230469\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"166.845703\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"222.460938\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"255.761719\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"311.376953\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"366.992188\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"400.292969\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"455.908203\" xlink:href=\"#ArialMT-55\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_8\">\n",
       "     <g id=\"line2d_8\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 396.799631 184.905 \n",
       "L 396.799631 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- 2022-12-29 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(351.511388 223.677285)rotate(-30)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"111.230469\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"166.845703\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"222.460938\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"255.761719\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"311.376953\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"366.992188\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"400.292969\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"455.908203\" xlink:href=\"#ArialMT-57\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_9\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 444.660252 184.905 \n",
       "L 444.660252 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- 2022-12-31 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(399.372009 223.677285)rotate(-30)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"111.230469\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"166.845703\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"222.460938\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"255.761719\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"311.376953\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"366.992188\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"400.292969\" xlink:href=\"#ArialMT-51\"/>\n",
       "       <use x=\"455.908203\" xlink:href=\"#ArialMT-49\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_10\">\n",
       "     <g id=\"line2d_10\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 468.590562 184.905 \n",
       "L 468.590562 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- 2023-01-01 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(423.302319 223.677285)rotate(-30)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"111.230469\" xlink:href=\"#ArialMT-50\"/>\n",
       "       <use x=\"166.845703\" xlink:href=\"#ArialMT-51\"/>\n",
       "       <use x=\"222.460938\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"255.761719\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"311.376953\" xlink:href=\"#ArialMT-49\"/>\n",
       "       <use x=\"366.992188\" xlink:href=\"#ArialMT-45\"/>\n",
       "       <use x=\"400.292969\" xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"455.908203\" xlink:href=\"#ArialMT-49\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 41.484375 177.492273 \n",
       "L 487.884375 177.492273 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- 0.0 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(20.584375 181.071179)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path d=\"M 9.078125 0 \n",
       "L 9.078125 10.015625 \n",
       "L 19.09375 10.015625 \n",
       "L 19.09375 0 \n",
       "z\n",
       "\" id=\"ArialMT-46\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-46\"/>\n",
       "       <use x=\"83.398438\" xlink:href=\"#ArialMT-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_12\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 41.484375 141.307266 \n",
       "L 487.884375 141.307266 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- 0.2 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(20.584375 144.886173)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-46\"/>\n",
       "       <use x=\"83.398438\" xlink:href=\"#ArialMT-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 41.484375 105.12226 \n",
       "L 487.884375 105.12226 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_13\">\n",
       "      <!-- 0.4 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(20.584375 108.701166)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path d=\"M 32.328125 0 \n",
       "L 32.328125 17.140625 \n",
       "L 1.265625 17.140625 \n",
       "L 1.265625 25.203125 \n",
       "L 33.9375 71.578125 \n",
       "L 41.109375 71.578125 \n",
       "L 41.109375 25.203125 \n",
       "L 50.78125 25.203125 \n",
       "L 50.78125 17.140625 \n",
       "L 41.109375 17.140625 \n",
       "L 41.109375 0 \n",
       "z\n",
       "M 32.328125 25.203125 \n",
       "L 32.328125 57.46875 \n",
       "L 9.90625 25.203125 \n",
       "z\n",
       "\" id=\"ArialMT-52\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-46\"/>\n",
       "       <use x=\"83.398438\" xlink:href=\"#ArialMT-52\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_14\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 41.484375 68.937254 \n",
       "L 487.884375 68.937254 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_14\">\n",
       "      <!-- 0.6 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(20.584375 72.51616)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path d=\"M 49.75 54.046875 \n",
       "L 41.015625 53.375 \n",
       "Q 39.84375 58.546875 37.703125 60.890625 \n",
       "Q 34.125 64.65625 28.90625 64.65625 \n",
       "Q 24.703125 64.65625 21.53125 62.3125 \n",
       "Q 17.390625 59.28125 14.984375 53.46875 \n",
       "Q 12.59375 47.65625 12.5 36.921875 \n",
       "Q 15.671875 41.75 20.265625 44.09375 \n",
       "Q 24.859375 46.4375 29.890625 46.4375 \n",
       "Q 38.671875 46.4375 44.84375 39.96875 \n",
       "Q 51.03125 33.5 51.03125 23.25 \n",
       "Q 51.03125 16.5 48.125 10.71875 \n",
       "Q 45.21875 4.9375 40.140625 1.859375 \n",
       "Q 35.0625 -1.21875 28.609375 -1.21875 \n",
       "Q 17.625 -1.21875 10.6875 6.859375 \n",
       "Q 3.765625 14.9375 3.765625 33.5 \n",
       "Q 3.765625 54.25 11.421875 63.671875 \n",
       "Q 18.109375 71.875 29.4375 71.875 \n",
       "Q 37.890625 71.875 43.28125 67.140625 \n",
       "Q 48.6875 62.40625 49.75 54.046875 \n",
       "z\n",
       "M 13.875 23.1875 \n",
       "Q 13.875 18.65625 15.796875 14.5 \n",
       "Q 17.71875 10.359375 21.1875 8.171875 \n",
       "Q 24.65625 6 28.46875 6 \n",
       "Q 34.03125 6 38.03125 10.484375 \n",
       "Q 42.046875 14.984375 42.046875 22.703125 \n",
       "Q 42.046875 30.125 38.078125 34.390625 \n",
       "Q 34.125 38.671875 28.125 38.671875 \n",
       "Q 22.171875 38.671875 18.015625 34.390625 \n",
       "Q 13.875 30.125 13.875 23.1875 \n",
       "z\n",
       "\" id=\"ArialMT-54\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-46\"/>\n",
       "       <use x=\"83.398438\" xlink:href=\"#ArialMT-54\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path clip-path=\"url(#p4bc53327c6)\" d=\"M 41.484375 32.752248 \n",
       "L 487.884375 32.752248 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:round;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"text_15\">\n",
       "      <!-- 0.8 -->\n",
       "      <g style=\"fill:#262626;\" transform=\"translate(20.584375 36.331154)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path d=\"M 17.671875 38.8125 \n",
       "Q 12.203125 40.828125 9.5625 44.53125 \n",
       "Q 6.9375 48.25 6.9375 53.421875 \n",
       "Q 6.9375 61.234375 12.546875 66.546875 \n",
       "Q 18.171875 71.875 27.484375 71.875 \n",
       "Q 36.859375 71.875 42.578125 66.421875 \n",
       "Q 48.296875 60.984375 48.296875 53.171875 \n",
       "Q 48.296875 48.1875 45.671875 44.5 \n",
       "Q 43.0625 40.828125 37.75 38.8125 \n",
       "Q 44.34375 36.671875 47.78125 31.875 \n",
       "Q 51.21875 27.09375 51.21875 20.453125 \n",
       "Q 51.21875 11.28125 44.71875 5.03125 \n",
       "Q 38.234375 -1.21875 27.640625 -1.21875 \n",
       "Q 17.046875 -1.21875 10.546875 5.046875 \n",
       "Q 4.046875 11.328125 4.046875 20.703125 \n",
       "Q 4.046875 27.6875 7.59375 32.390625 \n",
       "Q 11.140625 37.109375 17.671875 38.8125 \n",
       "z\n",
       "M 15.921875 53.71875 \n",
       "Q 15.921875 48.640625 19.1875 45.40625 \n",
       "Q 22.46875 42.1875 27.6875 42.1875 \n",
       "Q 32.765625 42.1875 36.015625 45.375 \n",
       "Q 39.265625 48.578125 39.265625 53.21875 \n",
       "Q 39.265625 58.0625 35.90625 61.359375 \n",
       "Q 32.5625 64.65625 27.59375 64.65625 \n",
       "Q 22.5625 64.65625 19.234375 61.421875 \n",
       "Q 15.921875 58.203125 15.921875 53.71875 \n",
       "z\n",
       "M 13.09375 20.65625 \n",
       "Q 13.09375 16.890625 14.875 13.375 \n",
       "Q 16.65625 9.859375 20.171875 7.921875 \n",
       "Q 23.6875 6 27.734375 6 \n",
       "Q 34.03125 6 38.125 10.046875 \n",
       "Q 42.234375 14.109375 42.234375 20.359375 \n",
       "Q 42.234375 26.703125 38.015625 30.859375 \n",
       "Q 33.796875 35.015625 27.4375 35.015625 \n",
       "Q 21.234375 35.015625 17.15625 30.90625 \n",
       "Q 13.09375 26.8125 13.09375 20.65625 \n",
       "z\n",
       "\" id=\"ArialMT-56\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#ArialMT-48\"/>\n",
       "       <use x=\"55.615234\" xlink:href=\"#ArialMT-46\"/>\n",
       "       <use x=\"83.398438\" xlink:href=\"#ArialMT-56\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_16\">\n",
       "     <!-- Total precipitation (cm) -->\n",
       "     <g style=\"fill:#262626;\" transform=\"translate(14.479688 153.654844)rotate(-90)scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path d=\"M 25.921875 0 \n",
       "L 25.921875 63.140625 \n",
       "L 2.34375 63.140625 \n",
       "L 2.34375 71.578125 \n",
       "L 59.078125 71.578125 \n",
       "L 59.078125 63.140625 \n",
       "L 35.40625 63.140625 \n",
       "L 35.40625 0 \n",
       "z\n",
       "\" id=\"ArialMT-84\"/>\n",
       "       <path d=\"M 3.328125 25.921875 \n",
       "Q 3.328125 40.328125 11.328125 47.265625 \n",
       "Q 18.015625 53.03125 27.640625 53.03125 \n",
       "Q 38.328125 53.03125 45.109375 46.015625 \n",
       "Q 51.90625 39.015625 51.90625 26.65625 \n",
       "Q 51.90625 16.65625 48.90625 10.90625 \n",
       "Q 45.90625 5.171875 40.15625 2 \n",
       "Q 34.421875 -1.171875 27.640625 -1.171875 \n",
       "Q 16.75 -1.171875 10.03125 5.8125 \n",
       "Q 3.328125 12.796875 3.328125 25.921875 \n",
       "z\n",
       "M 12.359375 25.921875 \n",
       "Q 12.359375 15.96875 16.703125 11.015625 \n",
       "Q 21.046875 6.0625 27.640625 6.0625 \n",
       "Q 34.1875 6.0625 38.53125 11.03125 \n",
       "Q 42.875 16.015625 42.875 26.21875 \n",
       "Q 42.875 35.84375 38.5 40.796875 \n",
       "Q 34.125 45.75 27.640625 45.75 \n",
       "Q 21.046875 45.75 16.703125 40.8125 \n",
       "Q 12.359375 35.890625 12.359375 25.921875 \n",
       "z\n",
       "\" id=\"ArialMT-111\"/>\n",
       "       <path d=\"M 25.78125 7.859375 \n",
       "L 27.046875 0.09375 \n",
       "Q 23.34375 -0.6875 20.40625 -0.6875 \n",
       "Q 15.625 -0.6875 12.984375 0.828125 \n",
       "Q 10.359375 2.34375 9.28125 4.8125 \n",
       "Q 8.203125 7.28125 8.203125 15.1875 \n",
       "L 8.203125 45.015625 \n",
       "L 1.765625 45.015625 \n",
       "L 1.765625 51.859375 \n",
       "L 8.203125 51.859375 \n",
       "L 8.203125 64.703125 \n",
       "L 16.9375 69.96875 \n",
       "L 16.9375 51.859375 \n",
       "L 25.78125 51.859375 \n",
       "L 25.78125 45.015625 \n",
       "L 16.9375 45.015625 \n",
       "L 16.9375 14.703125 \n",
       "Q 16.9375 10.9375 17.40625 9.859375 \n",
       "Q 17.875 8.796875 18.921875 8.15625 \n",
       "Q 19.96875 7.515625 21.921875 7.515625 \n",
       "Q 23.390625 7.515625 25.78125 7.859375 \n",
       "z\n",
       "\" id=\"ArialMT-116\"/>\n",
       "       <path d=\"M 40.4375 6.390625 \n",
       "Q 35.546875 2.25 31.03125 0.53125 \n",
       "Q 26.515625 -1.171875 21.34375 -1.171875 \n",
       "Q 12.796875 -1.171875 8.203125 3 \n",
       "Q 3.609375 7.171875 3.609375 13.671875 \n",
       "Q 3.609375 17.484375 5.34375 20.625 \n",
       "Q 7.078125 23.78125 9.890625 25.6875 \n",
       "Q 12.703125 27.59375 16.21875 28.5625 \n",
       "Q 18.796875 29.25 24.03125 29.890625 \n",
       "Q 34.671875 31.15625 39.703125 32.90625 \n",
       "Q 39.75 34.71875 39.75 35.203125 \n",
       "Q 39.75 40.578125 37.25 42.78125 \n",
       "Q 33.890625 45.75 27.25 45.75 \n",
       "Q 21.046875 45.75 18.09375 43.578125 \n",
       "Q 15.140625 41.40625 13.71875 35.890625 \n",
       "L 5.125 37.0625 \n",
       "Q 6.296875 42.578125 8.984375 45.96875 \n",
       "Q 11.671875 49.359375 16.75 51.1875 \n",
       "Q 21.828125 53.03125 28.515625 53.03125 \n",
       "Q 35.15625 53.03125 39.296875 51.46875 \n",
       "Q 43.453125 49.90625 45.40625 47.53125 \n",
       "Q 47.359375 45.171875 48.140625 41.546875 \n",
       "Q 48.578125 39.3125 48.578125 33.453125 \n",
       "L 48.578125 21.734375 \n",
       "Q 48.578125 9.46875 49.140625 6.21875 \n",
       "Q 49.703125 2.984375 51.375 0 \n",
       "L 42.1875 0 \n",
       "Q 40.828125 2.734375 40.4375 6.390625 \n",
       "z\n",
       "M 39.703125 26.03125 \n",
       "Q 34.90625 24.078125 25.34375 22.703125 \n",
       "Q 19.921875 21.921875 17.671875 20.9375 \n",
       "Q 15.4375 19.96875 14.203125 18.09375 \n",
       "Q 12.984375 16.21875 12.984375 13.921875 \n",
       "Q 12.984375 10.40625 15.640625 8.0625 \n",
       "Q 18.3125 5.71875 23.4375 5.71875 \n",
       "Q 28.515625 5.71875 32.46875 7.9375 \n",
       "Q 36.421875 10.15625 38.28125 14.015625 \n",
       "Q 39.703125 17 39.703125 22.796875 \n",
       "z\n",
       "\" id=\"ArialMT-97\"/>\n",
       "       <path d=\"M 6.390625 0 \n",
       "L 6.390625 71.578125 \n",
       "L 15.1875 71.578125 \n",
       "L 15.1875 0 \n",
       "z\n",
       "\" id=\"ArialMT-108\"/>\n",
       "       <path id=\"ArialMT-32\"/>\n",
       "       <path d=\"M 6.59375 -19.875 \n",
       "L 6.59375 51.859375 \n",
       "L 14.59375 51.859375 \n",
       "L 14.59375 45.125 \n",
       "Q 17.4375 49.078125 21 51.046875 \n",
       "Q 24.5625 53.03125 29.640625 53.03125 \n",
       "Q 36.28125 53.03125 41.359375 49.609375 \n",
       "Q 46.4375 46.1875 49.015625 39.953125 \n",
       "Q 51.609375 33.734375 51.609375 26.3125 \n",
       "Q 51.609375 18.359375 48.75 11.984375 \n",
       "Q 45.90625 5.609375 40.453125 2.21875 \n",
       "Q 35.015625 -1.171875 29 -1.171875 \n",
       "Q 24.609375 -1.171875 21.109375 0.6875 \n",
       "Q 17.625 2.546875 15.375 5.375 \n",
       "L 15.375 -19.875 \n",
       "z\n",
       "M 14.546875 25.640625 \n",
       "Q 14.546875 15.625 18.59375 10.84375 \n",
       "Q 22.65625 6.0625 28.421875 6.0625 \n",
       "Q 34.28125 6.0625 38.453125 11.015625 \n",
       "Q 42.625 15.96875 42.625 26.375 \n",
       "Q 42.625 36.28125 38.546875 41.203125 \n",
       "Q 34.46875 46.140625 28.8125 46.140625 \n",
       "Q 23.1875 46.140625 18.859375 40.890625 \n",
       "Q 14.546875 35.640625 14.546875 25.640625 \n",
       "z\n",
       "\" id=\"ArialMT-112\"/>\n",
       "       <path d=\"M 6.5 0 \n",
       "L 6.5 51.859375 \n",
       "L 14.40625 51.859375 \n",
       "L 14.40625 44 \n",
       "Q 17.4375 49.515625 20 51.265625 \n",
       "Q 22.5625 53.03125 25.640625 53.03125 \n",
       "Q 30.078125 53.03125 34.671875 50.203125 \n",
       "L 31.640625 42.046875 \n",
       "Q 28.421875 43.953125 25.203125 43.953125 \n",
       "Q 22.3125 43.953125 20.015625 42.21875 \n",
       "Q 17.71875 40.484375 16.75 37.40625 \n",
       "Q 15.28125 32.71875 15.28125 27.15625 \n",
       "L 15.28125 0 \n",
       "z\n",
       "\" id=\"ArialMT-114\"/>\n",
       "       <path d=\"M 42.09375 16.703125 \n",
       "L 51.171875 15.578125 \n",
       "Q 49.03125 7.625 43.21875 3.21875 \n",
       "Q 37.40625 -1.171875 28.375 -1.171875 \n",
       "Q 17 -1.171875 10.328125 5.828125 \n",
       "Q 3.65625 12.84375 3.65625 25.484375 \n",
       "Q 3.65625 38.578125 10.390625 45.796875 \n",
       "Q 17.140625 53.03125 27.875 53.03125 \n",
       "Q 38.28125 53.03125 44.875 45.953125 \n",
       "Q 51.46875 38.875 51.46875 26.03125 \n",
       "Q 51.46875 25.25 51.421875 23.6875 \n",
       "L 12.75 23.6875 \n",
       "Q 13.234375 15.140625 17.578125 10.59375 \n",
       "Q 21.921875 6.0625 28.421875 6.0625 \n",
       "Q 33.25 6.0625 36.671875 8.59375 \n",
       "Q 40.09375 11.140625 42.09375 16.703125 \n",
       "z\n",
       "M 13.234375 30.90625 \n",
       "L 42.1875 30.90625 \n",
       "Q 41.609375 37.453125 38.875 40.71875 \n",
       "Q 34.671875 45.796875 27.984375 45.796875 \n",
       "Q 21.921875 45.796875 17.796875 41.75 \n",
       "Q 13.671875 37.703125 13.234375 30.90625 \n",
       "z\n",
       "\" id=\"ArialMT-101\"/>\n",
       "       <path d=\"M 40.4375 19 \n",
       "L 49.078125 17.875 \n",
       "Q 47.65625 8.9375 41.8125 3.875 \n",
       "Q 35.984375 -1.171875 27.484375 -1.171875 \n",
       "Q 16.84375 -1.171875 10.375 5.78125 \n",
       "Q 3.90625 12.75 3.90625 25.734375 \n",
       "Q 3.90625 34.125 6.6875 40.421875 \n",
       "Q 9.46875 46.734375 15.15625 49.875 \n",
       "Q 20.84375 53.03125 27.546875 53.03125 \n",
       "Q 35.984375 53.03125 41.359375 48.75 \n",
       "Q 46.734375 44.484375 48.25 36.625 \n",
       "L 39.703125 35.296875 \n",
       "Q 38.484375 40.53125 35.375 43.15625 \n",
       "Q 32.28125 45.796875 27.875 45.796875 \n",
       "Q 21.234375 45.796875 17.078125 41.03125 \n",
       "Q 12.9375 36.28125 12.9375 25.984375 \n",
       "Q 12.9375 15.53125 16.9375 10.796875 \n",
       "Q 20.953125 6.0625 27.390625 6.0625 \n",
       "Q 32.5625 6.0625 36.03125 9.234375 \n",
       "Q 39.5 12.40625 40.4375 19 \n",
       "z\n",
       "\" id=\"ArialMT-99\"/>\n",
       "       <path d=\"M 6.640625 61.46875 \n",
       "L 6.640625 71.578125 \n",
       "L 15.4375 71.578125 \n",
       "L 15.4375 61.46875 \n",
       "z\n",
       "M 6.640625 0 \n",
       "L 6.640625 51.859375 \n",
       "L 15.4375 51.859375 \n",
       "L 15.4375 0 \n",
       "z\n",
       "\" id=\"ArialMT-105\"/>\n",
       "       <path d=\"M 6.59375 0 \n",
       "L 6.59375 51.859375 \n",
       "L 14.5 51.859375 \n",
       "L 14.5 44.484375 \n",
       "Q 20.21875 53.03125 31 53.03125 \n",
       "Q 35.6875 53.03125 39.625 51.34375 \n",
       "Q 43.5625 49.65625 45.515625 46.921875 \n",
       "Q 47.46875 44.1875 48.25 40.4375 \n",
       "Q 48.734375 37.984375 48.734375 31.890625 \n",
       "L 48.734375 0 \n",
       "L 39.9375 0 \n",
       "L 39.9375 31.546875 \n",
       "Q 39.9375 36.921875 38.90625 39.578125 \n",
       "Q 37.890625 42.234375 35.28125 43.8125 \n",
       "Q 32.671875 45.40625 29.15625 45.40625 \n",
       "Q 23.53125 45.40625 19.453125 41.84375 \n",
       "Q 15.375 38.28125 15.375 28.328125 \n",
       "L 15.375 0 \n",
       "z\n",
       "\" id=\"ArialMT-110\"/>\n",
       "       <path d=\"M 23.390625 -21.046875 \n",
       "Q 16.109375 -11.859375 11.078125 0.4375 \n",
       "Q 6.0625 12.75 6.0625 25.921875 \n",
       "Q 6.0625 37.546875 9.8125 48.1875 \n",
       "Q 14.203125 60.546875 23.390625 72.796875 \n",
       "L 29.6875 72.796875 \n",
       "Q 23.78125 62.640625 21.875 58.296875 \n",
       "Q 18.890625 51.5625 17.1875 44.234375 \n",
       "Q 15.09375 35.109375 15.09375 25.875 \n",
       "Q 15.09375 2.390625 29.6875 -21.046875 \n",
       "z\n",
       "\" id=\"ArialMT-40\"/>\n",
       "       <path d=\"M 6.59375 0 \n",
       "L 6.59375 51.859375 \n",
       "L 14.453125 51.859375 \n",
       "L 14.453125 44.578125 \n",
       "Q 16.890625 48.390625 20.9375 50.703125 \n",
       "Q 25 53.03125 30.171875 53.03125 \n",
       "Q 35.9375 53.03125 39.625 50.640625 \n",
       "Q 43.3125 48.25 44.828125 43.953125 \n",
       "Q 50.984375 53.03125 60.84375 53.03125 \n",
       "Q 68.5625 53.03125 72.703125 48.75 \n",
       "Q 76.859375 44.484375 76.859375 35.59375 \n",
       "L 76.859375 0 \n",
       "L 68.109375 0 \n",
       "L 68.109375 32.671875 \n",
       "Q 68.109375 37.9375 67.25 40.25 \n",
       "Q 66.40625 42.578125 64.15625 43.984375 \n",
       "Q 61.921875 45.40625 58.890625 45.40625 \n",
       "Q 53.421875 45.40625 49.796875 41.765625 \n",
       "Q 46.1875 38.140625 46.1875 30.125 \n",
       "L 46.1875 0 \n",
       "L 37.40625 0 \n",
       "L 37.40625 33.6875 \n",
       "Q 37.40625 39.546875 35.25 42.46875 \n",
       "Q 33.109375 45.40625 28.21875 45.40625 \n",
       "Q 24.515625 45.40625 21.359375 43.453125 \n",
       "Q 18.21875 41.5 16.796875 37.734375 \n",
       "Q 15.375 33.984375 15.375 26.90625 \n",
       "L 15.375 0 \n",
       "z\n",
       "\" id=\"ArialMT-109\"/>\n",
       "       <path d=\"M 12.359375 -21.046875 \n",
       "L 6.0625 -21.046875 \n",
       "Q 20.65625 2.390625 20.65625 25.875 \n",
       "Q 20.65625 35.0625 18.5625 44.09375 \n",
       "Q 16.890625 51.421875 13.921875 58.15625 \n",
       "Q 12.015625 62.546875 6.0625 72.796875 \n",
       "L 12.359375 72.796875 \n",
       "Q 21.53125 60.546875 25.921875 48.1875 \n",
       "Q 29.6875 37.546875 29.6875 25.921875 \n",
       "Q 29.6875 12.75 24.625 0.4375 \n",
       "Q 19.578125 -11.859375 12.359375 -21.046875 \n",
       "z\n",
       "\" id=\"ArialMT-41\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#ArialMT-84\"/>\n",
       "      <use x=\"49.958984\" xlink:href=\"#ArialMT-111\"/>\n",
       "      <use x=\"105.574219\" xlink:href=\"#ArialMT-116\"/>\n",
       "      <use x=\"133.357422\" xlink:href=\"#ArialMT-97\"/>\n",
       "      <use x=\"188.972656\" xlink:href=\"#ArialMT-108\"/>\n",
       "      <use x=\"211.189453\" xlink:href=\"#ArialMT-32\"/>\n",
       "      <use x=\"238.972656\" xlink:href=\"#ArialMT-112\"/>\n",
       "      <use x=\"294.587891\" xlink:href=\"#ArialMT-114\"/>\n",
       "      <use x=\"327.888672\" xlink:href=\"#ArialMT-101\"/>\n",
       "      <use x=\"383.503906\" xlink:href=\"#ArialMT-99\"/>\n",
       "      <use x=\"433.503906\" xlink:href=\"#ArialMT-105\"/>\n",
       "      <use x=\"455.720703\" xlink:href=\"#ArialMT-112\"/>\n",
       "      <use x=\"511.335938\" xlink:href=\"#ArialMT-105\"/>\n",
       "      <use x=\"533.552734\" xlink:href=\"#ArialMT-116\"/>\n",
       "      <use x=\"561.335938\" xlink:href=\"#ArialMT-97\"/>\n",
       "      <use x=\"616.951172\" xlink:href=\"#ArialMT-116\"/>\n",
       "      <use x=\"644.734375\" xlink:href=\"#ArialMT-105\"/>\n",
       "      <use x=\"666.951172\" xlink:href=\"#ArialMT-111\"/>\n",
       "      <use x=\"722.566406\" xlink:href=\"#ArialMT-110\"/>\n",
       "      <use x=\"778.181641\" xlink:href=\"#ArialMT-32\"/>\n",
       "      <use x=\"805.964844\" xlink:href=\"#ArialMT-40\"/>\n",
       "      <use x=\"839.265625\" xlink:href=\"#ArialMT-99\"/>\n",
       "      <use x=\"889.265625\" xlink:href=\"#ArialMT-109\"/>\n",
       "      <use x=\"972.566406\" xlink:href=\"#ArialMT-41\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_16\">\n",
       "    <path clip-path=\"url(#p4bc53327c6)\" d=\"M 61.775284 177.492273 \n",
       "L 187.409414 177.492273 \n",
       "L 188.40651 176.856659 \n",
       "L 189.403607 177.461269 \n",
       "L 198.377473 177.492273 \n",
       "L 254.214864 177.492273 \n",
       "L 255.21196 177.166698 \n",
       "L 256.209057 176.050489 \n",
       "L 257.206153 165.927069 \n",
       "L 258.203249 177.399261 \n",
       "L 260.197442 177.492273 \n",
       "L 339.965143 177.383759 \n",
       "L 340.96224 177.166698 \n",
       "L 341.959336 177.461269 \n",
       "L 348.93901 177.430265 \n",
       "L 349.936106 174.283165 \n",
       "L 350.933202 177.368257 \n",
       "L 351.930299 172.081752 \n",
       "L 352.927395 171.663165 \n",
       "L 353.924491 173.383984 \n",
       "L 354.921587 167.833945 \n",
       "L 355.918684 142.889741 \n",
       "L 356.91578 142.672681 \n",
       "L 357.912876 134.03755 \n",
       "L 358.909972 122.410336 \n",
       "L 359.907069 127.309263 \n",
       "L 360.904165 139.122495 \n",
       "L 361.901261 132.39424 \n",
       "L 362.898358 118.178031 \n",
       "L 363.895454 143.556358 \n",
       "L 364.89255 151.121789 \n",
       "L 365.889646 142.471156 \n",
       "L 366.886743 159.586397 \n",
       "L 367.883839 161.508741 \n",
       "L 368.880935 174.639744 \n",
       "L 369.878031 175.926474 \n",
       "L 370.875128 176.283052 \n",
       "L 371.872224 176.94967 \n",
       "L 372.86932 177.383759 \n",
       "L 374.863513 177.492273 \n",
       "L 402.782208 177.492273 \n",
       "L 403.779305 177.244208 \n",
       "L 404.776401 174.934281 \n",
       "L 405.773497 174.577736 \n",
       "L 406.770593 170.763984 \n",
       "L 407.76769 168.004467 \n",
       "L 408.764786 153.679779 \n",
       "L 409.761882 153.927811 \n",
       "L 410.758979 169.756323 \n",
       "L 411.756075 173.554539 \n",
       "L 412.753171 175.13584 \n",
       "L 413.750267 175.802458 \n",
       "L 414.747364 174.717253 \n",
       "L 415.74446 174.438184 \n",
       "L 416.741556 176.794651 \n",
       "L 417.738652 176.779149 \n",
       "L 418.735749 176.376064 \n",
       "L 419.732845 175.724948 \n",
       "L 420.729941 172.825879 \n",
       "L 421.727037 170.981045 \n",
       "L 422.724134 170.57796 \n",
       "L 423.72123 171.089559 \n",
       "L 424.718326 171.322088 \n",
       "L 425.715423 158.578702 \n",
       "L 426.712519 166.90376 \n",
       "L 427.709615 173.35298 \n",
       "L 428.706711 172.314281 \n",
       "L 429.703808 160.144501 \n",
       "L 430.700904 155.741641 \n",
       "L 431.698 165.244949 \n",
       "L 432.695096 171.229076 \n",
       "L 433.692193 173.321976 \n",
       "L 434.689289 172.51584 \n",
       "L 435.686385 173.88008 \n",
       "L 436.683482 173.585543 \n",
       "L 437.680578 173.43049 \n",
       "L 438.677674 174.314169 \n",
       "L 439.67477 173.042941 \n",
       "L 440.671867 175.786956 \n",
       "L 441.668963 176.205543 \n",
       "L 442.666059 165.570524 \n",
       "L 443.663155 157.571007 \n",
       "L 444.660252 160.578556 \n",
       "L 445.657348 159.074798 \n",
       "L 446.654444 161.105656 \n",
       "L 447.651541 161.741304 \n",
       "L 448.648637 159.632903 \n",
       "L 449.645733 154.237882 \n",
       "L 450.642829 134.921227 \n",
       "L 451.639926 144.393499 \n",
       "L 452.637022 144.905098 \n",
       "L 453.634118 155.927698 \n",
       "L 454.631214 157.664019 \n",
       "L 455.628311 155.230043 \n",
       "L 456.625407 148.703313 \n",
       "L 457.622503 75.886053 \n",
       "L 458.619599 103.961861 \n",
       "L 459.616696 75.684501 \n",
       "L 460.613792 69.498846 \n",
       "L 461.610888 61.700859 \n",
       "L 462.607985 87.07918 \n",
       "L 463.605081 62.677542 \n",
       "L 464.602177 29.237727 \n",
       "L 465.599273 47.28312 \n",
       "L 466.59637 97.326617 \n",
       "L 467.593466 106.070262 \n",
       "L 467.593466 106.070262 \n",
       "\" style=\"fill:none;stroke:#1f77b4;stroke-linecap:round;stroke-width:1.5;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 41.484375 184.905 \n",
       "L 41.484375 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 487.884375 184.905 \n",
       "L 487.884375 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 41.484375 184.905 \n",
       "L 487.884375 184.905 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 41.484375 21.825 \n",
       "L 487.884375 21.825 \n",
       "\" style=\"fill:none;stroke:#cccccc;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"text_17\">\n",
       "    <!-- longitude = 237.5, latitude = 37.75 -->\n",
       "    <g style=\"fill:#262626;\" transform=\"translate(173.949375 15.825)scale(0.12 -0.12)\">\n",
       "     <defs>\n",
       "      <path d=\"M 4.984375 -4.296875 \n",
       "L 13.53125 -5.5625 \n",
       "Q 14.0625 -9.515625 16.5 -11.328125 \n",
       "Q 19.78125 -13.765625 25.4375 -13.765625 \n",
       "Q 31.546875 -13.765625 34.859375 -11.328125 \n",
       "Q 38.1875 -8.890625 39.359375 -4.5 \n",
       "Q 40.046875 -1.8125 39.984375 6.78125 \n",
       "Q 34.234375 0 25.640625 0 \n",
       "Q 14.9375 0 9.078125 7.71875 \n",
       "Q 3.21875 15.4375 3.21875 26.21875 \n",
       "Q 3.21875 33.640625 5.90625 39.90625 \n",
       "Q 8.59375 46.1875 13.6875 49.609375 \n",
       "Q 18.796875 53.03125 25.6875 53.03125 \n",
       "Q 34.859375 53.03125 40.828125 45.609375 \n",
       "L 40.828125 51.859375 \n",
       "L 48.921875 51.859375 \n",
       "L 48.921875 7.03125 \n",
       "Q 48.921875 -5.078125 46.453125 -10.125 \n",
       "Q 44 -15.1875 38.640625 -18.109375 \n",
       "Q 33.296875 -21.046875 25.484375 -21.046875 \n",
       "Q 16.21875 -21.046875 10.5 -16.875 \n",
       "Q 4.78125 -12.703125 4.984375 -4.296875 \n",
       "z\n",
       "M 12.25 26.859375 \n",
       "Q 12.25 16.65625 16.296875 11.96875 \n",
       "Q 20.359375 7.28125 26.46875 7.28125 \n",
       "Q 32.515625 7.28125 36.609375 11.9375 \n",
       "Q 40.71875 16.609375 40.71875 26.5625 \n",
       "Q 40.71875 36.078125 36.5 40.90625 \n",
       "Q 32.28125 45.75 26.3125 45.75 \n",
       "Q 20.453125 45.75 16.34375 40.984375 \n",
       "Q 12.25 36.234375 12.25 26.859375 \n",
       "z\n",
       "\" id=\"ArialMT-103\"/>\n",
       "      <path d=\"M 40.578125 0 \n",
       "L 40.578125 7.625 \n",
       "Q 34.515625 -1.171875 24.125 -1.171875 \n",
       "Q 19.53125 -1.171875 15.546875 0.578125 \n",
       "Q 11.578125 2.34375 9.640625 5 \n",
       "Q 7.71875 7.671875 6.9375 11.53125 \n",
       "Q 6.390625 14.109375 6.390625 19.734375 \n",
       "L 6.390625 51.859375 \n",
       "L 15.1875 51.859375 \n",
       "L 15.1875 23.09375 \n",
       "Q 15.1875 16.21875 15.71875 13.8125 \n",
       "Q 16.546875 10.359375 19.234375 8.375 \n",
       "Q 21.921875 6.390625 25.875 6.390625 \n",
       "Q 29.828125 6.390625 33.296875 8.421875 \n",
       "Q 36.765625 10.453125 38.203125 13.9375 \n",
       "Q 39.65625 17.4375 39.65625 24.078125 \n",
       "L 39.65625 51.859375 \n",
       "L 48.4375 51.859375 \n",
       "L 48.4375 0 \n",
       "z\n",
       "\" id=\"ArialMT-117\"/>\n",
       "      <path d=\"M 40.234375 0 \n",
       "L 40.234375 6.546875 \n",
       "Q 35.296875 -1.171875 25.734375 -1.171875 \n",
       "Q 19.53125 -1.171875 14.328125 2.25 \n",
       "Q 9.125 5.671875 6.265625 11.796875 \n",
       "Q 3.421875 17.921875 3.421875 25.875 \n",
       "Q 3.421875 33.640625 6 39.96875 \n",
       "Q 8.59375 46.296875 13.765625 49.65625 \n",
       "Q 18.953125 53.03125 25.34375 53.03125 \n",
       "Q 30.03125 53.03125 33.6875 51.046875 \n",
       "Q 37.359375 49.078125 39.65625 45.90625 \n",
       "L 39.65625 71.578125 \n",
       "L 48.390625 71.578125 \n",
       "L 48.390625 0 \n",
       "z\n",
       "M 12.453125 25.875 \n",
       "Q 12.453125 15.921875 16.640625 10.984375 \n",
       "Q 20.84375 6.0625 26.5625 6.0625 \n",
       "Q 32.328125 6.0625 36.34375 10.765625 \n",
       "Q 40.375 15.484375 40.375 25.140625 \n",
       "Q 40.375 35.796875 36.265625 40.765625 \n",
       "Q 32.171875 45.75 26.171875 45.75 \n",
       "Q 20.3125 45.75 16.375 40.96875 \n",
       "Q 12.453125 36.1875 12.453125 25.875 \n",
       "z\n",
       "\" id=\"ArialMT-100\"/>\n",
       "      <path d=\"M 52.828125 42.09375 \n",
       "L 5.5625 42.09375 \n",
       "L 5.5625 50.296875 \n",
       "L 52.828125 50.296875 \n",
       "z\n",
       "M 52.828125 20.359375 \n",
       "L 5.5625 20.359375 \n",
       "L 5.5625 28.5625 \n",
       "L 52.828125 28.5625 \n",
       "z\n",
       "\" id=\"ArialMT-61\"/>\n",
       "      <path d=\"M 8.890625 0 \n",
       "L 8.890625 10.015625 \n",
       "L 18.890625 10.015625 \n",
       "L 18.890625 0 \n",
       "Q 18.890625 -5.515625 16.9375 -8.90625 \n",
       "Q 14.984375 -12.3125 10.75 -14.15625 \n",
       "L 8.296875 -10.40625 \n",
       "Q 11.078125 -9.1875 12.390625 -6.8125 \n",
       "Q 13.71875 -4.4375 13.875 0 \n",
       "z\n",
       "\" id=\"ArialMT-44\"/>\n",
       "     </defs>\n",
       "     <use xlink:href=\"#ArialMT-108\"/>\n",
       "     <use x=\"22.216797\" xlink:href=\"#ArialMT-111\"/>\n",
       "     <use x=\"77.832031\" xlink:href=\"#ArialMT-110\"/>\n",
       "     <use x=\"133.447266\" xlink:href=\"#ArialMT-103\"/>\n",
       "     <use x=\"189.0625\" xlink:href=\"#ArialMT-105\"/>\n",
       "     <use x=\"211.279297\" xlink:href=\"#ArialMT-116\"/>\n",
       "     <use x=\"239.0625\" xlink:href=\"#ArialMT-117\"/>\n",
       "     <use x=\"294.677734\" xlink:href=\"#ArialMT-100\"/>\n",
       "     <use x=\"350.292969\" xlink:href=\"#ArialMT-101\"/>\n",
       "     <use x=\"405.908203\" xlink:href=\"#ArialMT-32\"/>\n",
       "     <use x=\"433.691406\" xlink:href=\"#ArialMT-61\"/>\n",
       "     <use x=\"492.089844\" xlink:href=\"#ArialMT-32\"/>\n",
       "     <use x=\"519.873047\" xlink:href=\"#ArialMT-50\"/>\n",
       "     <use x=\"575.488281\" xlink:href=\"#ArialMT-51\"/>\n",
       "     <use x=\"631.103516\" xlink:href=\"#ArialMT-55\"/>\n",
       "     <use x=\"686.71875\" xlink:href=\"#ArialMT-46\"/>\n",
       "     <use x=\"714.501953\" xlink:href=\"#ArialMT-53\"/>\n",
       "     <use x=\"770.117188\" xlink:href=\"#ArialMT-44\"/>\n",
       "     <use x=\"797.900391\" xlink:href=\"#ArialMT-32\"/>\n",
       "     <use x=\"825.683594\" xlink:href=\"#ArialMT-108\"/>\n",
       "     <use x=\"847.900391\" xlink:href=\"#ArialMT-97\"/>\n",
       "     <use x=\"903.515625\" xlink:href=\"#ArialMT-116\"/>\n",
       "     <use x=\"931.298828\" xlink:href=\"#ArialMT-105\"/>\n",
       "     <use x=\"953.515625\" xlink:href=\"#ArialMT-116\"/>\n",
       "     <use x=\"981.298828\" xlink:href=\"#ArialMT-117\"/>\n",
       "     <use x=\"1036.914062\" xlink:href=\"#ArialMT-100\"/>\n",
       "     <use x=\"1092.529297\" xlink:href=\"#ArialMT-101\"/>\n",
       "     <use x=\"1148.144531\" xlink:href=\"#ArialMT-32\"/>\n",
       "     <use x=\"1175.927734\" xlink:href=\"#ArialMT-61\"/>\n",
       "     <use x=\"1234.326172\" xlink:href=\"#ArialMT-32\"/>\n",
       "     <use x=\"1262.109375\" xlink:href=\"#ArialMT-51\"/>\n",
       "     <use x=\"1317.724609\" xlink:href=\"#ArialMT-55\"/>\n",
       "     <use x=\"1373.339844\" xlink:href=\"#ArialMT-46\"/>\n",
       "     <use x=\"1401.123047\" xlink:href=\"#ArialMT-55\"/>\n",
       "     <use x=\"1456.738281\" xlink:href=\"#ArialMT-53\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p4bc53327c6\">\n",
       "   <rect height=\"163.08\" width=\"446.4\" x=\"41.484375\" y=\"21.825\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 576x216 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure()\n",
    "(ds.sel(latitude=37.75, longitude=237.5).tp * 100).plot(figsize=(8,3))\n",
    "plt.xlabel('')\n",
    "plt.ylabel('Total precipitation (cm)')\n",
    "plt.show();"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ca5a3f7b-75ae-4e79-a70a-43ebfc18674b",
   "metadata": {},
   "source": [
    "Next we choose one date, December 31, 2022, at 1 p.m., and narrow down the latitude and longitude to the continental US to make a map of temperature:   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "723a0a1d-baef-47eb-8ff1-b112e5554bed",
   "metadata": {},
   "outputs": [],
   "source": [
    "import datetime\n",
    "one_day = datetime.datetime(2022, 12, 31, 13, 0, 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "3e67148c-7763-47ff-8573-85a15539e9dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "min_lon, min_lat, max_lon, max_lat = 232, 21, 300, 50\n",
    "\n",
    "mask_lon = (ds.longitude > min_lon) & (ds.longitude < max_lon)\n",
    "mask_lat = (ds.latitude > min_lat) & (ds.latitude < max_lat)\n",
    "\n",
    "ds_oneday_us = ds.sel(time=one_day).t2m.where(mask_lon & mask_lat, drop=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "55b20258-1a90-48be-9aa8-7454430cfd0b",
   "metadata": {},
   "source": [
    "Like `loc` for dataframes, `sel` returns a new `DataArray` whose data is determined by the index labels along the specified dimension, which for this example is the date. And like `np.where`, `xr.where` returns elements depending on the logical condition provided. We use `drop=True` to reduce the size of the dataset."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ba77b96e-5aa9-49da-8f1e-3f270dfc8f22",
   "metadata": {},
   "source": [
    "Let's make a chloropleth map of temperature, where color represents the temperature:"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1684bb6e-a3a8-4e7b-ad27-cfd329538528",
   "metadata": {},
   "source": [
    "```python\n",
    "ds_oneday_us.plot(figsize=(8,4))\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "a6aff02a-e375-4921-a7c3-681933061e98",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "ds_oneday_us.plot(figsize=(8,4))\n",
    "plt.savefig('figures/USmap.jpg', dpi=300)\n",
    "plt.close();"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8d2d2dc5-12a6-417c-bf1f-1fcac150ff56",
   "metadata": {},
   "source": [
    "<img src=\"figures/USmap.jpg\" width=\"600\" />"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4f94d4ec-b48b-4dcf-b450-a1b884ca28fe",
   "metadata": {},
   "source": [
    "We can make out the shape of the US, the warm Caribbean, and the colder mountain ranges from this map.\n",
    "\n",
    "We wrap up by closing the file:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "ff8b1901-0e15-412e-96ba-249c77117d42",
   "metadata": {},
   "outputs": [],
   "source": [
    "ds.close()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "589a96eb-7f98-4653-a635-5053a55d25a1",
   "metadata": {},
   "source": [
    "This brief introduction to NetCDF is meant to touch on the basic concepts. Our main goal is to show that other kinds of data formats exist and can have advantages over plain-text read into a dataframe. For interested readers, NetCDF has a rich ecosystem of packages and functionality. For example, in addition to the `xarray` module, NetCDF files can be read with other Python modules like [`netCDF4`](http://unidata.github.io/netcdf4-python/) and [`gdal`](https://gdal.org/drivers/raster/netcdf.html). The NetCDF community has also provided command-line tools for interacting with NetCDF data. And to make visualizations and maps, options include `matplotlib`, [`iris`](https://scitools-iris.readthedocs.io/en/stable/) which is built on top of `netCDF4`, and [`cartopy`](https://scitools.org.uk/cartopy/docs/latest/)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "43fc074f-e004-47d1-a892-bcbf056f11da",
   "metadata": {},
   "source": [
    "Next we consider the JSON format, which offers more flexibility to represent hierarchical data compared to the CSV and FWF formats."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
